package com.group.mall.mapper;

import com.group.mall.domain.POJO.Comments;
import com.group.mall.domain.VO.GoodsImageAndNameVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentsMapper {
    /**
     * 根据id查询历史评价
     * @param
     * @return
     */

    @Select("select a.*,b.name,b.image from hmall.evaluation a,hmall.goods b where a.goods_id = b.goods_id")
    List<Comments> getComments();

    @Select("SELECT username FROM hmall.user WHERE id = #{id}")
    String getUserName(Long id);

    @Select("SELECT image FROM hmall.goods WHERE goods_id = #{goodsId}")
    String getImage(Long goodsId);

    @Select("SELECT image,name FROM hmall.goods WHERE goods_id = #{goodsId}")
    List<GoodsImageAndNameVO> getGoodsImageAndName(Long goodsId);

    List<Comments> getCommentList(Integer goodsId);

    List<Comments> getCommentLimitList(Integer goodsId);
}
